else
rm -rf rustc *.exe
if [ "${BITS}" = "64" ]; then
- triple=x86_64-w64-mingw32
+ triple=x86_64-pc-windows-gnu
else
- triple=i686-w64-mingw32
+ triple=i686-pc-windows-gnu
fi
curl -O http://$host/dist/rust-nightly-$triple.exe
innounp -y -x rust-nightly-$triple.exe
version = "0.0.1-pre"
dependencies = [
"curl 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle)",
- "docopt 0.6.5 (git+https://github.com/docopt/docopt.rs)",
+ "docopt 0.6.8 (git+https://github.com/docopt/docopt.rs)",
"flate2 0.0.1 (git+https://github.com/alexcrichton/flate2-rs)",
"git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs)",
"glob 0.0.1 (git+https://github.com/rust-lang/glob)",
[[package]]
name = "curl"
version = "0.0.1"
-source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#28d4a3d0dde0cde6b6f46fc928656cb251832888"
+source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#b595431adb3ff1ad55e3cff30ee8b0c05d9103a0"
dependencies = [
"curl-sys 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle)",
"link-config 0.0.1 (git+https://github.com/alexcrichton/link-config)",
[[package]]
name = "curl-sys"
version = "0.0.1"
-source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#28d4a3d0dde0cde6b6f46fc928656cb251832888"
+source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#b595431adb3ff1ad55e3cff30ee8b0c05d9103a0"
[[package]]
name = "docopt"
-version = "0.6.5"
-source = "git+https://github.com/docopt/docopt.rs#6db6dc0177ea739be9b90f18ab87a674413797a1"
+version = "0.6.8"
+source = "git+https://github.com/docopt/docopt.rs#1b614c83b771b23e95e69d10b4bc04c87ff7eff3"
[[package]]
name = "encoding"
version = "0.1.0"
-source = "git+https://github.com/lifthrasiir/rust-encoding#6daaad9f4c0fcde4525821032686090d6426c462"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a739425a3f3174a31fe38c158dcaf22ea1d856f4"
[[package]]
name = "flate2"
version = "0.0.1"
-source = "git+https://github.com/alexcrichton/flate2-rs#67be37548937c059370ce272efe1142fbf198d67"
+source = "git+https://github.com/alexcrichton/flate2-rs#31d9253355ba837cd62487b8766bf2be89f334a3"
[[package]]
name = "git2"
version = "0.0.1"
-source = "git+https://github.com/alexcrichton/git2-rs#35a0632e92d63de8218675a17cd81e15d0de44b4"
+source = "git+https://github.com/alexcrichton/git2-rs#556e27113a4918cede9b80e447a5ebad524f3357"
dependencies = [
"libgit2 0.0.1 (git+https://github.com/alexcrichton/git2-rs)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
[[package]]
name = "libgit2"
version = "0.0.1"
-source = "git+https://github.com/alexcrichton/git2-rs#35a0632e92d63de8218675a17cd81e15d0de44b4"
+source = "git+https://github.com/alexcrichton/git2-rs#556e27113a4918cede9b80e447a5ebad524f3357"
dependencies = [
"libssh2-static-sys 0.0.1 (git+https://github.com/alexcrichton/libssh2-static-sys)",
"link-config 0.0.1 (git+https://github.com/alexcrichton/link-config)",
[[package]]
name = "libssh2-static-sys"
version = "0.0.1"
-source = "git+https://github.com/alexcrichton/libssh2-static-sys#80e71a3021618eb05656c58fb7c5ef5f12bc747f"
+source = "git+https://github.com/alexcrichton/libssh2-static-sys#c0dc19bd7a9096b6c79911f4135cd4fb79962127"
[[package]]
name = "link-config"
[[package]]
name = "toml"
version = "0.1.0"
-source = "git+https://github.com/alexcrichton/toml-rs#71d1689d63ef1af41addef330e314a56e88f48a9"
+source = "git+https://github.com/alexcrichton/toml-rs#78acb5081d57bec85fd51ecb596506b14d17d430"
[[package]]
name = "url"
s => (flags.arg_args.clone(), s),
};
args.insert(0, command.to_string());
+ args.insert(0, os::args()[0].clone());
macro_rules! cmd( ($name:ident) => (
if command.as_slice() == stringify!($name).replace("_", "-").as_slice() {
-use std::collections::hashmap::{HashSet, HashMap, Occupied, Vacant};
+use std::collections::HashSet;
+use std::collections::hash_map::{HashMap, Occupied, Vacant};
use core::{Source, SourceId, SourceMap, Summary, Dependency, PackageId, Package};
use util::{CargoResult, ChainError, Config, human, profile};
/// operations if necessary) and is ready to be queried for packages.
pub struct PackageRegistry<'a> {
sources: SourceMap<'a>,
- config: &'a mut Config<'a>,
+ config: &'a Config<'a>,
// A list of sources which are considered "overrides" which take precedent
// when querying for packages.
}
impl<'a> PackageRegistry<'a> {
- pub fn new<'a>(config: &'a mut Config<'a>) -> PackageRegistry<'a> {
+ pub fn new<'a>(config: &'a Config<'a>) -> PackageRegistry<'a> {
PackageRegistry {
sources: SourceMap::new(),
source_ids: HashMap::new(),
use std::cell::RefCell;
-use std::collections::hashmap::{HashMap, HashSet, Occupied, Vacant};
+use std::collections::HashSet;
+use std::collections::hash_map::{HashMap, Occupied, Vacant};
use std::fmt;
use std::rc::Rc;
use semver;
-use std::cmp::Ordering;
-use std::collections::HashMap;
-use std::collections::hashmap::{Values, MutEntries};
+use std::collections::hash_map::{HashMap, Values, MutEntries};
use std::fmt::{mod, Show, Formatter};
use std::hash;
use std::iter;
}
/// Creates an implementation of `Source` corresponding to this ID.
- pub fn load<'a>(&self, config: &'a mut Config) -> Box<Source+'a> {
+ pub fn load<'a>(&self, config: &'a Config) -> Box<Source+'a> {
log!(5, "loading SourceId; {}", self);
match self.inner.kind {
GitKind(..) => box GitSource::new(self, config) as Box<Source+'a>,
}
}
-pub struct SourceMap<'a> {
- map: HashMap<SourceId, Box<Source+'a>>
+pub struct SourceMap<'src> {
+ map: HashMap<SourceId, Box<Source+'src>>
}
-pub type Sources<'a> = Values<'a, SourceId, Box<Source+'a>>;
-pub type SourcesMut<'a> = iter::Map<'static, (&'a SourceId, &'a mut Box<Source+'a>),
- &'a mut Source+'a,
- MutEntries<'a, SourceId, Box<Source+'a>>>;
+pub type Sources<'a, 'src> = Values<'a, SourceId, Box<Source+'src>>;
+pub type SourcesMut<'a, 'src> = iter::Map<'static, (&'a SourceId,
+ &'a mut Box<Source+'src>),
+ &'a mut Source+'src,
+ MutEntries<'a, SourceId, Box<Source+'src>>>;
-impl<'a> SourceMap<'a> {
- pub fn new() -> SourceMap<'a> {
+impl<'src> SourceMap<'src> {
+ pub fn new() -> SourceMap<'src> {
SourceMap {
map: HashMap::new()
}
self.map.contains_key(id)
}
- pub fn get(&self, id: &SourceId) -> Option<&Source+'a> {
+ pub fn get(&self, id: &SourceId) -> Option<&Source+'src> {
let source = self.map.find(id);
source.map(|s| {
- let s: &Source+'a = &**s;
+ let s: &Source+'src = &**s;
s
})
}
- pub fn get_mut(&mut self, id: &SourceId) -> Option<&mut Source+'a> {
+ pub fn get_mut(&mut self, id: &SourceId) -> Option<&mut Source+'src> {
self.map.find_mut(id).map(|s| {
- let s: &mut Source+'a = &mut **s;
+ let s: &mut Source+'src = &mut **s;
s
})
}
- pub fn get_by_package_id(&self, pkg_id: &PackageId) -> Option<&Source+'a> {
+ pub fn get_by_package_id(&self, pkg_id: &PackageId) -> Option<&Source+'src> {
self.get(pkg_id.get_source_id())
}
- pub fn insert(&mut self, id: &SourceId, source: Box<Source+'a>) {
+ pub fn insert(&mut self, id: &SourceId, source: Box<Source+'src>) {
self.map.insert(id.clone(), source);
}
self.map.len()
}
- pub fn sources(&'a self) -> Sources<'a> {
+ pub fn sources<'a>(&'a self) -> Sources<'a, 'src> {
self.map.values()
}
- pub fn sources_mut(&'a mut self) -> SourcesMut<'a> {
- self.map.iter_mut().map(|(_, v)| { let s: &mut Source+'a = &mut **v; s })
+ pub fn sources_mut<'a>(&'a mut self) -> SourcesMut<'a, 'src> {
+ self.map.iter_mut().map(|(_, v)| &mut **v)
}
}
/// List of `Source` implementors. `SourceSet` itself implements `Source`.
-pub struct SourceSet<'a> {
- sources: Vec<Box<Source+'a>>
+pub struct SourceSet<'src> {
+ sources: Vec<Box<Source+'src>>
}
-impl<'a> SourceSet<'a> {
- pub fn new(sources: Vec<Box<Source+'a>>) -> SourceSet<'a> {
+impl<'src> SourceSet<'src> {
+ pub fn new(sources: Vec<Box<Source+'src>>) -> SourceSet<'src> {
SourceSet { sources: sources }
}
}
-impl<'a> Registry for SourceSet<'a> {
+impl<'src> Registry for SourceSet<'src> {
fn query(&mut self, name: &Dependency) -> CargoResult<Vec<Summary>> {
let mut ret = Vec::new();
}
}
-impl<'a> Source for SourceSet<'a> {
+impl<'src> Source for SourceSet<'src> {
fn update(&mut self) -> CargoResult<()> {
for source in self.sources.iter_mut() {
try!(source.update());
use std::io::stdio::{stdout_raw, stderr_raw};
use std::io::{mod, stdout, stderr};
use serialize::{Decoder, Encoder, Decodable, Encodable, json};
+use docopt::Docopt;
use core::{Shell, MultiShell, ShellConfig};
use term::color::{BLACK};
fn process<'a, V: Encodable<json::Encoder<'a>, io::IoError>>(
callback: |&[String], &mut MultiShell| -> CliResult<Option<V>>) {
let mut shell = shell(true);
- let mut args = os::args();
- args.remove(0);
- process_executed(callback(args.as_slice(), &mut shell), &mut shell)
+ process_executed(callback(os::args().as_slice(), &mut shell), &mut shell)
}
pub fn process_executed<'a,
fn flags_from_args<'a, T>(usage: &str, args: &[String],
options_first: bool) -> CliResult<T>
where T: Decodable<docopt::Decoder, docopt::Error> {
- let args = args.iter().map(|a| a.as_slice()).collect::<Vec<&str>>();
- let config = docopt::Config {
- options_first: options_first,
- help: true,
- version: Some(version()),
- };
- let value_map = try!(docopt::docopt_args(config, args.as_slice(),
- usage).map_err(|e| {
- let code = if e.fatal() {1} else {0};
- CliError::from_error(e, code)
- }));
- value_map.decode().map_err(|e| {
+ let docopt = Docopt::new(usage).unwrap()
+ .options_first(options_first)
+ .argv(args.iter().map(|s| s.as_slice()))
+ .help(true)
+ .version(Some(version()));
+ docopt.decode().map_err(|e| {
let code = if e.fatal() {1} else {0};
CliError::from_error(e, code)
})
let user_configs = try!(config::all_configs(os::getcwd()));
let override_ids = try!(source_ids_from_config(&user_configs,
package.get_root()));
+ let config = try!(Config::new(*shell, jobs, target.clone()));
let (packages, resolve_with_overrides, sources) = {
- let mut config = try!(Config::new(*shell, jobs, target.clone()));
let rustc_host = config.rustc_host().to_string();
- let mut registry = PackageRegistry::new(&mut config);
+ let mut registry = PackageRegistry::new(&config);
// First, resolve the package's *listed* dependencies, as well as
// downloading and updating all remotes and such.
let ret = {
let _p = profile::start("compiling");
- let mut config = try!(Config::new(*shell, jobs, target));
- try!(scrape_target_config(&mut config, &user_configs));
+ try!(scrape_target_config(&config, &user_configs));
try!(ops::compile_targets(env.as_slice(), targets.as_slice(), to_build,
&PackageSet::new(packages.as_slice()),
&resolve_with_overrides, &sources,
- &mut config))
+ &config))
};
return Ok(ret);
}).map(|p| SourceId::for_path(&p)).collect()
}
-fn scrape_target_config(config: &mut Config,
+fn scrape_target_config(config: &Config,
configs: &HashMap<String, config::ConfigValue>)
-> CargoResult<()> {
let target = match configs.find_equiv("target") {
-use std::collections::{HashMap, HashSet};
-use std::collections::hashmap::{Occupied, Vacant};
+use std::collections::HashSet;
+use std::collections::hash_map::{HashMap, Occupied, Vacant};
use std::str;
use core::{SourceMap, Package, PackageId, PackageSet, Resolve, Target};
PlatformPluginAndTarget,
}
-pub struct Context<'a, 'b> {
- pub config: &'b mut Config<'b>,
+pub struct Context<'a, 'b: 'a> {
+ pub config: &'b Config<'b>,
pub resolve: &'a Resolve,
pub sources: &'a SourceMap<'b>,
pub compilation: Compilation,
requirements: HashMap<(&'a PackageId, &'a str), PlatformRequirement>,
}
-impl<'a, 'b> Context<'a, 'b> {
- pub fn new(env: &'a str, resolve: &'a Resolve, sources: &'a SourceMap,
- deps: &'a PackageSet, config: &'b mut Config<'b>,
+impl<'a, 'b: 'a> Context<'a, 'b> {
+ pub fn new(env: &'a str, resolve: &'a Resolve, sources: &'a SourceMap<'b>,
+ deps: &'a PackageSet, config: &'b Config<'b>,
host: Layout, target: Option<Layout>,
root_pkg: &Package)
-> CargoResult<Context<'a, 'b>> {
Some((dylib_parts[0].to_string(), dylib_parts[1].to_string()))
};
- let exe_suffix = lines.next().unwrap().trim()
- .split('-').skip(1).next().unwrap().to_string();
+ let exe_suffix = if error.contains("dropping unsupported crate type `bin`") {
+ String::new()
+ } else {
+ lines.next().unwrap().trim()
+ .split('-').skip(1).next().unwrap().to_string()
+ };
Ok((dylib, exe_suffix.to_string()))
}
-use std::collections::hashmap::{Occupied, Vacant};
+use std::collections::hash_map::{Occupied, Vacant};
use std::hash::{Hash, Hasher};
use std::hash::sip::SipHasher;
use std::io::{fs, File, USER_RWX, BufferedReader};
-use std::collections::hashmap::{HashMap, HashSet, Occupied, Vacant};
+use std::collections::HashSet;
+use std::collections::hash_map::{HashMap, Occupied, Vacant};
use term::color::YELLOW;
use core::{Package, PackageId, Resolve, PackageSet};
impl<'a, 'b> JobQueue<'a, 'b> {
pub fn new(resolve: &'a Resolve, packages: &'a PackageSet,
- config: &mut Config) -> JobQueue<'a, 'b> {
+ config: &Config) -> JobQueue<'a, 'b> {
let (tx, rx) = channel();
JobQueue {
pool: TaskPool::new(config.jobs()),
/// This function will spawn off `config.jobs()` workers to build all of the
/// necessary dependencies, in order. Freshness is propagated as far as
/// possible along each dependency chain.
- pub fn execute(&mut self, config: &mut Config) -> CargoResult<()> {
+ pub fn execute(&mut self, config: &Config) -> CargoResult<()> {
let _p = profile::start("executing the job graph");
// Iteratively execute the dependency graph. Each turn of this loop will
/// freshness of all upstream dependencies. This function will schedule all
/// work in `jobs` to be executed.
fn run(&mut self, pkg: &'a Package, stage: TargetStage, fresh: Freshness,
- jobs: Vec<(Job, Freshness)>, config: &mut Config) -> CargoResult<()> {
+ jobs: Vec<(Job, Freshness)>, config: &Config) -> CargoResult<()> {
let njobs = jobs.len();
let amt = if njobs == 0 {1} else {njobs};
let id = pkg.get_package_id().clone();
pub fn compile_targets<'a>(env: &str, targets: &[&'a Target], pkg: &'a Package,
deps: &PackageSet, resolve: &'a Resolve,
sources: &'a SourceMap,
- config: &'a mut Config<'a>)
+ config: &'a Config<'a>)
-> CargoResult<Compilation> {
if targets.is_empty() {
return Ok(Compilation::new(pkg))
.rpath(root_profile.get_rpath())
}
+ if profile.is_plugin() {
+ cmd = cmd.arg("-C").arg("prefer-dynamic");
+ }
+
if profile.get_opt_level() != 0 {
cmd = cmd.arg("--opt-level").arg(profile.get_opt_level().to_string());
}
}
cmd = opt(cmd, "--target", "", cx.config.target());
- cmd = opt(cmd, "-C", "ar=", cx.config.ar());
- cmd = opt(cmd, "-C", "linker=", cx.config.linker());
+ cmd = opt(cmd, "-C", "ar=", cx.config.ar().as_ref()
+ .map(|s| s.as_slice()));
+ cmd = opt(cmd, "-C", "linker=", cx.config.linker().as_ref()
+ .map(|s| s.as_slice()));
}
return cmd;
source_id: SourceId,
path_source: Option<PathSource>,
rev: Option<GitRevision>,
- config: &'a mut Config<'b>,
+ config: &'a Config<'b>,
}
impl<'a, 'b> GitSource<'a, 'b> {
pub fn new<'a, 'b>(source_id: &SourceId,
- config: &'a mut Config<'b>) -> GitSource<'a, 'b> {
+ config: &'a Config<'b>) -> GitSource<'a, 'b> {
assert!(source_id.is_git(), "id is not git, id={}", source_id);
let reference = match source_id.git_reference() {
checkout_path: Path,
cache_path: Path,
src_path: Path,
- config: &'a mut Config<'b>,
+ config: &'a Config<'b>,
handle: Option<http::Handle>,
sources: Vec<PathSource>,
hashes: HashMap<(String, String), String>, // (name, vers) => cksum
impl<'a, 'b> RegistrySource<'a, 'b> {
pub fn new(source_id: &SourceId,
- config: &'a mut Config<'b>) -> RegistrySource<'a, 'b> {
+ config: &'a Config<'b>) -> RegistrySource<'a, 'b> {
let hash = hex::short_hash(source_id);
let ident = source_id.get_url().host().unwrap().to_string();
let part = format!("{}-{}", ident, hash);
let dep = try!(Dependency::parse(name.as_slice(), Some(req.as_slice()),
&self.source_id));
-
+
Ok(dep.optional(optional)
.default_features(default_features)
.features(features)
use std::{fmt, os, mem};
+use std::cell::{RefCell, RefMut, Ref};
+use std::collections::hash_map::{HashMap, Occupied, Vacant};
use std::io::fs::{PathExtensions, File};
-use std::collections::HashMap;
-use std::collections::hashmap::{Occupied, Vacant};
use std::string;
use serialize::{Encodable,Encoder};
pub struct Config<'a> {
home_path: Path,
- shell: &'a mut MultiShell,
+ shell: RefCell<&'a mut MultiShell>,
jobs: uint,
target: Option<string::String>,
- linker: Option<string::String>,
- ar: Option<string::String>,
+ linker: RefCell<Option<string::String>>,
+ ar: RefCell<Option<string::String>>,
rustc_version: string::String,
/// The current host and default target of rustc
rustc_host: string::String,
human("Cargo couldn't find your home directory. \
This probably means that $HOME was not set.")
})),
- shell: shell,
+ shell: RefCell::new(shell),
jobs: jobs.unwrap_or(os::num_cpus()),
target: target,
- ar: None,
- linker: None,
+ ar: RefCell::new(None),
+ linker: RefCell::new(None),
rustc_version: rustc_version,
rustc_host: rustc_host,
})
self.home_path.join(".cargo").join("registry").join("src")
}
- pub fn shell(&mut self) -> &mut MultiShell {
- &mut *self.shell
+ pub fn shell(&self) -> RefMut<&'a mut MultiShell> {
+ self.shell.borrow_mut()
}
pub fn jobs(&self) -> uint {
self.target.as_ref().map(|t| t.as_slice())
}
- pub fn set_ar(&mut self, ar: string::String) { self.ar = Some(ar); }
-
- pub fn set_linker(&mut self, linker: string::String) { self.linker = Some(linker); }
-
- pub fn linker(&self) -> Option<&str> {
- self.linker.as_ref().map(|t| t.as_slice())
+ pub fn set_ar(&self, ar: string::String) {
+ *self.ar.borrow_mut() = Some(ar);
}
- pub fn ar(&self) -> Option<&str> {
- self.ar.as_ref().map(|t| t.as_slice())
+
+ pub fn set_linker(&self, linker: string::String) {
+ *self.linker.borrow_mut() = Some(linker);
}
+ pub fn linker(&self) -> Ref<Option<string::String>> { self.linker.borrow() }
+ pub fn ar(&self) -> Ref<Option<string::String>> { self.ar.borrow() }
+
/// Return the output of `rustc -v verbose`
pub fn rustc_version(&self) -> &str {
self.rustc_version.as_slice()
//! it to figure out when a dependency should be built.
use std::collections::{HashMap, HashSet};
-use std::collections::hashmap::{Occupied, Vacant};
+use std::collections::hash_map::{Occupied, Vacant};
use std::hash::Hash;
pub struct DependencyQueue<K, V> {
use std::fmt;
use std::hash::Hash;
use std::collections::{HashMap, HashSet};
-use std::collections::hashmap::{Keys, Occupied, SetItems, Vacant};
+use std::collections::hash_map::{Keys, Occupied, Vacant};
+use std::collections::hash_set::SetItems;
pub struct Graph<N> {
nodes: HashMap<N, HashSet<N>>
me = mac32
elif triple == 'x86_64-apple-darwin':
me = mac64
-elif triple == 'i686-w64-mingw32':
+elif triple == 'i686-pc-windows-gnu':
+ triple = 'i686-w64-mingw32'
me = win32
-elif triple == 'x86_64-w64-mingw32':
+elif triple == 'x86_64-pc-windows-gnu':
+ triple = 'x86_64-w64-mingw32'
me = win64
else:
raise Exception("no snapshot for the triple: " + triple)